import React, { useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";

const List = () => {
  const list = useSelector((state) => state.getIn(["list", "list"]));
  const dispatch = useDispatch();

  useEffect(() => {
    dispatch({ type: "loadDataAction" });
  }, [dispatch]);

  return (
    <ul>
      {list.map((item) => (
        <li key={item._id}>{item.title}</li>
      ))}
    </ul>
  );
};

export default List;
